package com.md.common.enums;

/**
 * 功能描述：性别
 *
 * @author lujianping@oak168.com
 * @version 1.0
 * @date 2018-06-26 17:24
 * @since JDK 1.8
 */
public enum SexEnum {
    MALE(1,"男"),
    FEMALE(2,"女"),
    SEC(3,"保密")
    ;

    private int value;
    private String name;

    SexEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public static SexEnum getEnum(int value){
        for(SexEnum e : SexEnum.values()){
            if (e.getValue() == value) {
                return e;
            }
        }
        return null;
    }

    public static SexEnum getEnumByName(String name){
        for(SexEnum e : SexEnum.values()){
            if (e.getName().equals(name)) {
                return e;
            }
        }
        return SEC;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
